home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-02-18 | 5.0 KB | 132 lines | [TEXT/CWIE] |
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- /*
- Apple Macintosh Developer Technical Support
-
- SoundUnit
-
- SoundUnit.h - C public header
-
- Versions:
- 1.03 January, 1990
- 1.04 Sept, 1990
- 1.2 August, 1994 translated to C
-
- Components:
- SoundApp.c January, 1990 MPW C source code
- SoundUnit.c January, 1990 MPW C source code
- SoundUnit.h January, 1990 MPW C source code
- SoundApp.r January, 1990 MPW Rez source code
- SoundAppSnds.r January, 1990 MPW Rez source code
- SoundApp.make January, 1990 MPW build script
-
- Formatting was done with FONT = Courier or Monaco, SIZE = 10, TABS = 4
-
- SoundApp.p is a sample application source file for demonstrating the
- Sound Manager. This portion of the source code handles the Sound Manager
- porting of the application. This SoundUnit can be used by others.
-
- Jim Reekes E.O., Macintosh Developer Technical Support
- Sunday, August 7, 1994 7:06:41 PM
- */
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- #ifndef __SOUNDUNIT__
- #define __SOUNDUNIT__
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // constants
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- //refer to the SoundAppSnds.r file for documentation on these values
- enum {
- kOctave1 = 0, //octaves of MIDI values
- kOctave2 = 12,
- kOctave3 = 24,
- kOctave4 = 36,
- kOctave5 = 48,
- kOctave6 = 60,
- kOctave7 = 72,
- kOctave8 = 84,
- kOctave9 = 96,
- kOctave10 = 108,
- kOctave11 = 120,
-
- Akey = -3, //the key A
- Bbkey = -2, //the key B flat
- Bkey = -1, //the key B
- Ckey = 0, //the key C
- Dbkey = 1, //the key D flat
- Dkey = 2, //the key D
- Ebkey = 3, //the key D flat
- Ekey = 4, //the key E
- Fkey = 5, //the key F
- Gbkey = 6, //the key G flat
- Gkey = 7, //the key G
- Abkey = 8, //the key A flat
-
- //These are other constants used in the SoundUnit
-
- kInitNone = 0, //no init options
- kWait = false, //wait for the channel
- kSMAsynch = true, //asynchronous Sound Manager call
- kWaveSize = 512, //standard size of wave table
- kSyncID = 0x12345678, //identifier used in syncCmd
- kOneSecond = 2000, //one second frequency duration
-
- kNoSynth = 0 //no synth is specified
- };
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- //types
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- typedef SndCommand *SndCmdPtr; // Ptr to a sound command, for type coersion
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // prototypes
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- /*
- The routines below are for public consumption in this SoundUnit. Note that
- these all return standard sound channels to allow easy of modifications.
- I can change the structure of my own sound channels and the code without
- forcing a change in the application that uses this SoundUnit.
-
- VERSION 1.1: No longer putting the SANELib into a seperate segment, which then
- needs to be unloaded. Instead, I merge it into the Main segment. Refer to
- the Make file for more information.
- */
-
- pascal void _SoundUnit(void);
- pascal OSErr InitSoundUnit(void);
- pascal Boolean HasMACE(void);
- pascal Boolean HasSoundInput(void);
- pascal Boolean HasStereoSupport(void);
- pascal short GetSoundMgrVersion(void);
- pascal Boolean HasSoundCompleted(void);
- pascal Boolean HasChannelOpen(void);
- pascal OSErr SendQuiet(SndChannelPtr chan, Boolean immediate);
- pascal void DoSoundComplete(void);
- pascal void FreeAllChans(void);
- pascal void FreeSoundUnit(void);
- pascal OSErr SoundComplete(SndChannelPtr chan);
- pascal OSErr HoldSnd(SndListHandle sndHandle);
- pascal OSErr PlaySong(SndChannelPtr chan, SndListHandle sndSong);
- pascal OSErr SetSquareWaveTimbre(SndChannelPtr squareChan, short timbre, Boolean immediate);
- pascal OSErr SendNote(SndChannelPtr chan, short duration, long note);
- pascal OSErr SendRest(SndChannelPtr chan, short duration);
- pascal OSErr GetSquareWaveChan(SndChannelPtr *squareChan, short timbre);
- pascal OSErr GetNoSynthChan(SndChannelPtr *chan);
- pascal OSErr GetSampleChan(SndChannelPtr *sampleChan, long init, SndListHandle sndInstrument);
- pascal OSErr Get4SampleInstruments(SndChannelPtr *chan1, SndChannelPtr *chan2, SndChannelPtr *chan3, SndChannelPtr *chan4, SndListHandle sndInstrument1, SndListHandle sndInstrument2, SndListHandle sndInstrument3, SndListHandle sndInstrument4);
- pascal Boolean HasWorkingWaveTables(void);
- pascal OSErr GetWaveChans(SndChannelPtr *waveChan1, SndChannelPtr *waveChan2, SndChannelPtr *waveChan3, SndChannelPtr *waveChan4);
- pascal OSErr InstallWave(SndChannelPtr waveChan, Ptr aWavePtr, short waveLength);
- pascal OSErr Play4ChanSongs(SndChannelPtr chan1, SndChannelPtr chan2, SndChannelPtr chan3, SndChannelPtr chan4, SndListHandle song1, SndListHandle song2, SndListHandle song3, SndListHandle song4);
- pascal long GetSndDataOffset(SndListHandle sndHandle, short *dataType, short *waveLength);
- pascal OSErr HyperSndPlay(SndListHandle sndHandle);
- pascal OSErr AsynchSndPlay(SndListHandle sndHandle);
-
- #endif
-